#include<bits/stdc++.h>
using namespace std;
#define int long long

struct node {
	int x, y, step;
};

int dx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
int dy[] = {1, 2, 2, 1, -1, -2, -2, -1};

int n, m, x, y;

int step[405][405];
bool vis[405][405];

void bfs() {
	memset(step, -1, sizeof step);

	queue<node> q;
	q.push({x, y, 0});
	vis[x][y] = 1;

	while (!q.empty()) {
		node t = q.front();
		q.pop();

		step[t.x][t.y] = t.step;

		for (int i = 0; i < 8; i++) {
			int xx = t.x + dx[i];
			int yy = t.y + dy[i];

			if (xx < 1 || xx > n || yy < 1 || yy > m || vis[xx][yy])
				continue;

			q.push({xx, yy, t.step + 1});
			vis[xx][yy] = 1;
		}
	}
}

signed main() {
	cin >> n >> m >> x >> y;
	bfs();

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			cout << step[i][j] << "    ";
		cout << endl;
	}
	return 0;
}
